package context;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;

// ******************************************************************
// *** CLASS: ErrorScreen
// ******************************************************************
public class ErrorScreen extends Alert implements Debug.Constants
{ //private static final boolean DEBUG=true; // Overriding Context.Constants.DEBUG
  private static final Command okCommand=new Command("OK",Command.OK,0);
  private static final Command exitCommand=new Command("Exit",Command.EXIT,1);

//  private boolean BUSY=true;
//  public boolean busy() { return(BUSY); }
  
  public ErrorScreen(String msg)
  { super("ERROR");
    setString(msg);
//    setTimeout(Alert.FOREVER);
    final Displayable prev=Context.setCurrent(this);
    
//    if(DEBUG) Debug.println("New ErrorScreen");
    this.addCommand(okCommand);
    this.addCommand(exitCommand);
    this.setCommandListener(new CommandListener()
    { public void commandAction(Command c,Displayable s)
      { if(c==exitCommand) Context.exit();
    	else if(c==okCommand) Context.setCurrent(prev);
      }
    });
    

  }
}